#include <xml/Stream.h>
#include <Box2D/Collision/Shapes/b2Shape.h>
#include <memory>

namespace physics
{

class ShapeLoader: public xml::ObjectANSI
{
	std::auto_ptr <b2Shape> shape;
	b2Shape::Type shapeType;

	bool on_attribute(xml::Provider *prov, const std::string &name, const std::string &value);

public:
	virtual ~ShapeLoader() {}
	virtual std::auto_ptr <b2Shape> GetShape() { return shape; }
};


template <class T> class ConcreteShapeLoader: public ShapeLoader
{
	std::auto_ptr <T> shape;

	//bool on_node(xml::Provider *prov, const std::string &name);

public:
	ConcreteShapeLoader(): shape(new T()) {}
	std::auto_ptr <b2Shape> GetShape() { return std::auto_ptr <b2Shape>(shape.release()); }
};

}